Generating contextual search presentations

ABSTRACT

Methods, systems, and apparatus, including computer programs encoded on computer storage media, for generating contextual search presentations. One of the methods includes obtaining selection data identifying a term selected by a user from a document displayed to the user; determining whether or not the context data and the selection data satisfy one or more criteria for presenting any of one or more types of special case contextual search presentations; in response to determining that the context data and the selection satisfy criteria for presenting a first type of special case contextual search presentation, generating a first special case contextual search presentation of the first type; in response to determining that the context data and the selection data do not satisfy the criteria, generating a default contextual search presentation; and providing the first special case contextual search presentation or the default contextual search presentation for presentation to the user.

BACKGROUND

This specification relates to Internet search engines.

Internet search engines aim to identify resources, e.g., web pages,images, text documents, and multimedia content, that are relevant to auser's information needs and to present information about the resourcesin a manner that is most useful to the user. Internet search enginesgenerally return a set of search results, each identifying a respectiveresource, in response to a user-submitted query.

SUMMARY

This specification describes technologies that relate to generatingcontextual search presentations.

In general, one innovative aspect of the subject matter described inthis specification can be embodied in methods that include the actionsof obtaining selection data identifying a term selected by a user from adocument displayed to the user, the term comprising one or more adjacentwords, and context data comprising one or more other words in thedocument; determining whether or not the context data and the selectiondata satisfy one or more criteria for presenting any of one or moretypes of special case contextual search presentations, wherein each typeof special case contextual search presentation includes a formattedpresentation of a different type of content; in response to determiningthat the context data and the selection satisfy criteria for presentinga first type of special case contextual search presentation, generatinga first special case contextual search presentation of the first typefor the selected term; in response to determining that the context dataand the selection data do not satisfy the criteria for presenting any ofthe types of special case contextual search presentations, generating adefault contextual search presentation for the selected term; andproviding the first special case contextual search presentation or thedefault contextual search presentation for presentation to the user.Other embodiments of this aspect include corresponding computer systems,apparatus, and computer programs recorded on one or more computerstorage devices, each configured to perform the actions of the methods.For a system of one or more computers to be configured to performparticular operations or actions means that the system has installed onit software, firmware, hardware, or a combination of them that inoperation cause the system to perform the operations or actions. For oneor more computer programs to be configured to perform particularoperations or actions means that the one or more programs includeinstructions that, when executed by data processing apparatus, cause theapparatus to perform the operations or actions.

The foregoing and other embodiments can each optionally include one ormore of the following features, alone or in combination. The defaultcontextual search presentation can be a definitional answer box, whereinthe definitional answer box is a formatted presentation of a definitionof the term selected by the user, and wherein generating the contextualsearch presentation comprises obtaining the definitional answer box froma search engine in response to a first search query that includes theselected term. Generating the default contextual search presentation caninclude obtaining search results from the search engine for one or moresearch queries derived from the selected term.

The one or more types of special case contextual search presentationscan include an entity type of contextual search presentation thatincludes a knowledge panel, and wherein a knowledge panel is a formattedpresentation of content relevant to an entity. Determining whether ornot the context data and the selection data satisfy criteria forpresenting the entity type of special case contextual searchpresentation can include: determining, by providing the context data andthe selection data to an entity disambiguation system, whether or notthe selected term refers to an entity in context of the other words inthe document.

The actions can further include: determining that the selected termrefers to an entity in context of the other words in the document; andgenerating an entity contextual search presentation for the selectedterm, comprising obtaining a knowledge panel for the entity referred toby the selected term from a search engine.

The one or more types of special case contextual search presentationscan include a currency type of contextual search presentation thatincludes a currency answer box, wherein a currency answer box is aformatted presentation of an amount in a first currency and acorresponding amount in a second currency. Determining whether or notthe context data and the selection data satisfy criteria for presentingthe currency type of contextual search presentation can include:determining whether or not the context data and selection data identifyany currency and any identified currency is different from a currencyassociated with the user.

The actions can further include: determining that the context data andthe selection data identify an amount in an identified currency and thatthe identified currency is different from the currency associated withthe user; and generating a currency contextual search presentation forthe context data and the selection data, comprising obtaining, from asearch engine, a currency answer box including an amount in theidentified currency and a corresponding amount in the currencyassociated with the user.

The one or more types of special case contextual search presentationscan include a translation type of contextual search presentation thatincludes a translation answer box, and wherein a translation answer boxis a formatted presentation of a translation of a word in a firstlanguage to a word in a second language. Determining whether or not thecontext data and the selection data satisfy criteria for presenting thetranslation type of contextual search presentation can include:identifying a language in which the selected term is written anddetermining whether or not the language in which the selected term iswritten is different from a language associated with the user.

The actions can further include: determining that the language in whichthe selected term is written is different from the language associatedwith the user of the user device; and generating a translationcontextual search presentation for the selected term, comprisingobtaining, from a search engine, a translation answer box including atranslation of the selected term into the language associated with theuser.

The one or more types of special case contextual search presentationscan include a time zone type of contextual search presentation thatincludes a time zone answer box, wherein a time zone answer box is aformatted presentation of a time in a first time zone and acorresponding time in a second time zone. Determining whether or not thecontext data and the selection data satisfy criteria for presenting thetime zone type of contextual search presentation can include:determining whether or not the selected term identifies a time in aparticular time zone and whether the particular time zone is differentfrom a time zone associated with the user.

The actions can further include: determining that the selected termidentifies a time in a particular time zone that is different from thetime zone associated with the user; generating a time zone contextualsearch presentation for the selected term, comprising obtaining, from asearch engine, a time zone answer box the time in the particular timezone and a corresponding time in the time zone associated with the user.

The subject matter described in this specification can be implemented inparticular embodiments so as to realize one or more of the followingadvantages. A user viewing a document on a user device can easily obtainrelevant information about a portion of a document, e.g., a word in thedocument, one or more adjacent words in the document, or another portionof the document. The relevant information is provided to the user in amanner that takes into account the context of the word in the documentor the context that the user is in. Additionally, different kinds ofinformation relevant to the portion of the document can be provided tothe user depending on the context, improving the user experience.Furthermore, the relevant information can be provided to the user in amanner that allows the user to easily view the information whilecontinuing to view the displayed document. The user can identify theportion of the document that he or she desires relevant informationabout through a simple gesture, e.g., a tap touch input or a long-presstouch input on a touchscreen display.

The details of one or more embodiments of the subject matter of thisspecification are set forth in the accompanying drawings and thedescription below. Other features, aspects, and advantages of thesubject matter will become apparent from the description, the drawings,and the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1A shows an example document displayed on an example mobile device.

FIG. 1B shows an example drag-up bar displayed on the example mobiledevice.

FIG. 1C shows a portion of an example contextual search presentationdisplayed on the example mobile device.

FIG. 1D shows a larger portion of the example contextual searchpresentation displayed on the example mobile device.

FIG. 2 shows an example search system.

FIG. 3 is a flow diagram of an example process for generating acontextual search presentation for a selected word.

FIG. 4 is a flow diagram of an example process for determining whethercriteria for presenting special case contextual search presentations aresatisfied and generating special case contextual search presentations.

Like reference numbers and designations in the various drawings indicatelike elements.

DETAILED DESCRIPTION

FIG. 1A shows an example document 102 displayed on an example mobiledevice 104. In particular, the document 102 is displayed in a webbrowser executing on the mobile device 104. In the example of FIG. 1A, auser of the mobile device 104 has submitted a touch input 106 on thetouchscreen display of the mobile device 104 to select a word, “Anders,”in the document 102.

FIG. 1B shows an example drag-up bar 110 displayed on the example mobiledevice 104. The drag-up bar 110 is a user interface element thatdisplays the name of an entity “Anders Fogh Rasmussen” that is referredto by the word selected by the user of the mobile device 104. In orderto identify the entity referred to by the input, the mobile device 104has provided word selection data and context data to a search system.The word selection data identifies the word selected by the user, i.e.,“Anders,” and the context data includes other words from the document102. For example, the context data can include each word within athreshold number of words of the selected word in the document. Thecontext data can also include other words or terms associated with thedocument, e.g., the title of the document, headings in the document,captions of images in the document, or anchor text of in-links to thedocument. In response, the search system has provided to the mobiledevice 104 data identifying the entity referred to by the selected wordin the context of the other words in the document, and the mobile device104 has used the data received from the search system to display thename of the entity in the drag-up bar 110.

FIG. 1C shows a portion 120 of an example contextual search presentationdisplayed on the example mobile device 104. In the example of FIG. 1C,the user of the mobile device 104 has submitted a touch input 122selecting and dragging the drag-up bar 110. In response, the mobiledevice 104 has moved the drag-up bar 110 to the corresponding positionto display the portion 120 of the contextual search presentation. Thecontextual search presentation is a presentation that is generated bythe search system for the selected word using the word selection dataand the context data received from the mobile device 104. In some cases,the mobile device 104 has obtained the contextual search presentationfrom the search system before the user submitted the input 122, e.g.,along with the data identifying the entity referred to by the selectedword. In other cases, the mobile device 104 has obtained the contextualsearch presentation from the search system in response to the user inputselecting the drag-up bar.

In the example of FIG. 1C, the contextual search presentation is anentity contextual search presentation that includes a knowledge panel124 for the entity “Anders Fogh Rasmussen.” A knowledge panel is a userinterface element generated by a search engine that includes a formattedpresentation of content about an entity referred to by a received searchquery. The content includes textual representations of values ofattributes associated with the entity and, optionally, other contentrelevant to the entity, e.g., images of the entity. The relevant contentcan vary depending on the type of the entity. For example, a knowledgepanel for a monument or other geographic point of interest can includedifferent information than a knowledge panel for a politician or otherperson of interest. However, as described below, if the word selected bythe user does not refer to an entity, a different kind of contextualsearch presentation can be generated that includes other kinds offormatted content, e.g., various kinds of answer boxes that presentformatted content related to the selected word.

FIG. 1D shows a larger portion 130 of the example contextual searchpresentation displayed on the example mobile device 104. In someimplementations, the mobile device 104 displays the larger portion 130in response to the user of the mobile device continuing to drag thedrag-up bar 110 to a new position. In some other implementations, themobile device continues to increase the size of the portion 130 afterthe user has stopped submitting the touch input 122. For example, afterthe user has stopped submitting the touch input 122, e.g., once the userhas released his or her finger from the touch screen display, the mobiledevice 104 can continue to increase the size of the portion 130 untilthe portion 130 fills a pre-determined proportion, e.g., fifty percent,sixty percent, or seventy percent, of the display. Optionally, when thesize of the portion 130 of contextual search presentation changes, themobile device 104 can re-center the displayed document 102 so that theword selected by the user remains visible.

The larger portion 130 of the contextual search presentation includesthe knowledge panel 124 for the entity “Anders Fogh Rasmussen” andsearch results 134. The search results 134 are search results generatedby a search engine in response to a search query identifying the entityreferred to by the selected word. The user of the mobile device 104 canview additional search results by submitting an additional touch inputto scroll down on the contextual search presentation or can return toviewing the document 102 by submitting a touch input pulling down on thedrag-up bar 110.

FIG. 2 shows an example search system 214. The search system 214 is anexample of an information retrieval system implemented as computerprograms on one or more computers in one or more locations, in which thesystems, components, and techniques described below are implemented.

A user 202 can interact with the search system 214 through a user device204. The user device 204 will generally include a memory, e.g., a randomaccess memory (RAM) 206, for storing instructions and data and aprocessor 208 for executing stored instructions. The memory can includeboth read only and writable memory. For example, the user device 204 canbe a computer, e.g., a smartphone, coupled to the search system 214through a data communication network 212, e.g., local area network (LAN)or wide area network (WAN), e.g., the Internet, or a combination ofnetworks, any of which may include wireless links.

In some implementations, the search system 214 provides a user interfaceto the user device 204 through which the user 202 can interact with thesearch system 214. For example, the search system 214 can provide a userinterface in the form of web pages that are rendered by a web browserrunning on the user device 204, in an app installed on the user device204, e.g., on a mobile device, or otherwise.

A user 202 can use the user device 204 to submit a query 210 to a searchsystem 214. A search engine 230 within the search system 214 performs asearch to identify resources matching the query. When the user 202submits a query 210, the query 210 may be transmitted through thenetwork 212 to the search system 224. The search system 214 includes anindex 222 and the search engine 230. The search system 214 responds tothe search query 210 by generating search results 218, which aretransmitted through the network 212 to the user device 204 forpresentation to the user 202, e.g., as a search results web page to bedisplayed by a web browser running on the user device 204.

When the query 210 is received by the search engine 230, the searchengine 230 identifies resources that satisfy the query 210. The searchengine 230 will generally include an indexing engine 220 that indexesresources, an index 222 that stores the index information, and a rankingengine 252 or other software that generates scores for the resourcesthat satisfy the query 210 and that ranks the resources according totheir respective scores.

Registered users of the search system 214 may provide data to the searchsystem that is stored in a user profile data repository 260. That is,the user 202 may log in to a user account with the search system 214,e.g., through a web browser executing on the user device 204, andprovide data identifying values of particular user attributes, e.g., theuser's birthday, the user's city of residence, places the user hasvacationed, and so on, that are stored in the user profile datarepository 260.

The search system 214 includes or can communicate with a contextualsearch engine 250. The contextual search engine 250 receives wordselection data and context data from user devices and, in response,generates an appropriate contextual search presentation for the selectedword identified by the word selection data. The contextual searchpresentation includes a formatted presentation of content that isrelevant to the selected word. Optionally, the contextual searchpresentation can also include search results obtained from the searchengine 230.

In order to select an appropriate contextual search presentation for agiven selected word, the contextual search engine 250 can communicatewith an entity disambiguation system 270.

The entity disambiguation system 270 receives data identifying a wordfrom a document and context data for the word, i.e., data identifyingother words in the same document as the identified word, and classifiesthe word as either not referring to any entity or referring to aparticular entity. Example entities include people, places, countries,landmarks, animals, historical events, organizations, businesses, sportsteams, sporting events, movies, songs, albums, games, works of art,fictional characters, and so on. For example, the entity disambiguationsystem 270 may be a system that analyzes documents or portions ofdocuments and determines which words in the document refer to entitiesidentified in a database that stores information about entities, e.g., adatabase of structured data that includes nodes that represent entitiesand identifies the type of each entity represented by a node. An exampleof an online database of structured data that exists is the Freebasedatabase that is accessible on the Internet at http://www.freebase.com.

In some cases, the contextual search engine 250 may receive anidentifier for a user account as part of the context data for a selectedword and may use user profile data for the user account that is storedin the user profile data repository 260 in selecting an appropriatecontextual search presentation. Optionally, if the contextual searchengine 250 receives context data that does not include an identifier orif no profile data or limited profile data is stored in the user profiledata repository 260 for the user account identified by a receivedidentifier, the contextual search engine 250 may computationally inferuser attribute values for the user from attribute values of the userdevice from which the search query is received. The contextual searchengine 250 may then use the inferred user attribute values in place ofuser profile data in selecting the appropriate contextual searchpresentation.

Selecting and generating a contextual search presentation using receivedword selection data and context data is described in more detail belowwith reference to FIGS. 3 and 4.

Once the contextual search engine 250 has generated a contextual searchpresentation, the search system 214 transmits the contextual searchpresentation to the user device from which the word selection data andthe context data were received for presentation to the user.

FIG. 3 is a flow diagram of an example process 300 for generating acontextual search presentation for a selected word. For convenience, theprocess 300 will be described as being performed by a system of one ormore computers located in one or more locations. For example, a searchsystem, e.g., the search system 214 of FIG. 2, appropriately programmedin accordance with this specification, can perform the process 300.

The system receives word selection data and context data from a userdevice (step 302). The word selection data identifies a word selected bya user in a document displayed to the user on the user device.Generally, the context data includes one or more other words in thedocument displayed to the user. For example, the context data mayinclude each word that is within a threshold number of words of theselected word in the displayed document. However, the context data mayalso include additional information. For example, the additionalinformation can include user information, e.g., an identifier for a useraccount with the system that the user is currently logged into on theuser device. As another example, the additional information can alsoinclude user device information, e.g., location data that identifies thegeographic location of the user device, language data that identifies apreferred language setting on the user device, sensor data, e.g.,temperature data, and so on.

The system determines, from the word selection data and the contextdata, whether one or more criteria for presenting any of a set of typesof special case contextual search presentations are satisfied (step304). Determining whether the criteria for presenting a special casecontextual presentation are satisfied is described below with referenceto FIG. 4.

If the word selection data and the context data satisfy the criteria forpresenting one of the types of special case contextual searchpresentations, the system generates a special case contextual searchpresentation of the type for the word selected by the user (step 306).Generating a special case contextual search presentation is describedbelow with reference to FIG. 4.

If the word selection data and the context data do not satisfy thecriteria for any of the types of special case presentations, the systemgenerates a default contextual search presentation for the word selectedby the user (step 308).

In some implementations, the default contextual search presentation is adefinitional contextual search presentation. A definitional contextualsearch presentation is a presentation that includes a definitionalanswer box for the word selected by the user.

Generally, an answer box is generated by a search engine, e.g., thesearch engine 230 of FIG. 2, in response to a received search query andincludes a formatted presentation of content that is relevant to thereceived search query. More specifically, a definitional answer box isan answer box generated by the search engine that includes a definitionfor a word in a received search query.

In order to generate the definitional contextual search presentation,the system requests a definitional answer box for the word selected bythe user from the search engine. For example, the system can request thedefinitional answer box by submitting a search query having apre-determined syntax to the search engine, e.g., “[word] definition,”“define: [word],” or “define [word],” where [word] is the word selectedby the user.

The definitional contextual search presentation may also include searchresults obtained from the search engine. The search results may includeone or more of search results obtained in response to the search queryderived from the selected word, search results from other resultsources, or search results for other interpretations of the searchquery. In some implementations, the search results may include searchresults for another search query that is different from the search querysubmitted to the search engine in order to obtain the definitionalanswer box.

The system obtains the definitional answer box and, optionally, thesearch results for the other search query from the search engine andgenerates a definitional answer box that includes the definitionalanswer box and, if search results were obtained, the search results.

The system provides the generated contextual search presentation forpresentation to the user on the user device (step 310). In someimplementations, the system generates and provides the contextual searchpresentation to the user device without receiving any additional userinput after the word selection data and the context data is received. Insome other implementations, the system may only generate and provide thecontextual search presentation after the user has submitted anadditional input, e.g., selecting and dragging a drag-up bar userinterface element on the user device, e.g., the drag-up bar 110 of FIGS.1B-1D.

The above description describes the steps of the process 300 beingperformed by a system remote from the user device that received the userselection of the word. However, in some implementations, some or all ofthe steps of the process 300 are performed by the user device. Forexample, the user device can receive the user input selecting the word,generate the context data for the selected word, and determine whether aspecial case or default contextual search presentation is to bepresented. Once the user device determines the kind of contextual searchpresentation that is to be presented, the system can provide dataidentifying the contextual search presentation, the word selection data,and the context data to the remote system for use in generating anappropriate contextual search presentation. As another example, all ofthe steps of the process 300 can be performed by the user device.

FIG. 4 is a flow diagram of an example process 400 for determiningwhether criteria for presenting special case contextual searchpresentations are satisfied and generating special case contextualsearch presentations. For convenience, the process 400 will be describedas being performed by a system of one or more computers located in oneor more locations. For example, a search system, e.g., the search system214 of FIG. 2, appropriately programmed in accordance with thisspecification, can perform the process 400.

The system receives word selection data and context data (step 402).

The system determines whether the selected word refers to an entityusing the context data (step 404). In order to make this determination,the system provides data identifying the selected word and dataidentifying the other words in the document to an entity disambiguationsystem, e.g., the entity disambiguation system 270 of FIG. 2. Inresponse, the system obtains from the entity disambiguation system dataindicating whether the selected word refers to an entity in the contextof the other words in the document and, if so, the entity referred to bythe selected word.

If the selected word refers to an entity, the system determines that thecriteria for presenting an entity contextual search presentation aresatisfied (step 406) and generates an entity contextual searchpresentation for the entity referred to by the selected word (step 408).An entity contextual search presentation is a presentation that includesa knowledge card for the entity referred to by the word selected by theuser. In order to generate the entity contextual search presentation,the system requests a knowledge card for the word selected by the userfrom the search engine. For example, the system can request theknowledge card by submitting a search query derived from a name of theentity to the search engine, e.g., a search query that includes the nameof the entity and, optionally, one or more terms that disambiguate theentity from other entities having similar names, e.g., “[entity][type],” where [entity] is the name of the entity and [type] is the typeof the entity. For example, if the referred to entity is the basketballplayer “Michael Jordan,” the search query submitted to the search enginemay be “Michael Jordan basketball player.” If the referred to entity isthe actor “Michael Jordan,” however, the search query submitted to thesearch engine may be “Michael Jordan actor.”

As another example, the system can request the knowledge card from thesearch engine by providing to the search engine an identifier for a nodethat represents the entity in an online database of structured data.

The entity contextual search presentation may optionally also includesearch results obtained from the search engine in response to the searchquery derived from the name of the entity referred to by the selectedword.

If the selected word does not refer to an entity, the system determineswhether the criteria for presenting any other special case contextualsearch presentations are satisfied (step 410) and, if the criteria forpresenting any of the other special cases are satisfied, the systemgenerates a special case contextual search presentation for the selectedword (step 412).

For example, the other special case contextual search presentations mayinclude a currency contextual search presentation. A currency contextualsearch presentation is a contextual search presentation that includes acurrency answer box. A currency answer box is an answer box thatpresents an amount in one currency and a corresponding amount in anothercurrency according to a current exchange rate.

In order to determine whether the criteria for presenting the currencycontextual search presentation are satisfied, the system determineswhether the word selected by the user identifies a particular currencyand, if so, whether the particular currency is different from a currencyassociated with the user. The system can determine that the wordselected by the user identifies the currency when the user has selecteda currency name, e.g., “euro,” sign, e.g., “

,” or code, e.g., “EUR.” Optionally, the system can also determine thatthe word selected by the user identifies a currency when the user hasselected a number or a number word and the context data includes acurrency name, sign, or code.

The system can determine whether the particular currency is differentfrom the currency associated with the user from the received contextdata. For example, if the context data includes an identifier for a useraccount associated with the user, the system can determine, from userprofile data for the user account, the country of residence of the userand can determine whether the particular currency is different from theofficial currency or currencies for the country of residence. As anotherexample, if the context data does not include an identifier for the useraccount associated with the user, the system can determine, fromlocation data for the user device, the country where the user device islocated and can determine whether the particular currency is differentfrom the official currency or currencies for that country. In someimplementations, the system determines that the currency associated withthe user is the official currency of the country where the user deviceis located even if data identifying the official currency of the countryof residence is available, e.g., to account for users travelling inforeign countries and selecting currency amounts in their home currencywanting to know the corresponding amount in the foreign currency.

If the particular currency is different from the currency associatedwith the user, the system determines that the criteria for presenting acurrency contextual search presentation are satisfied and generates acurrency contextual search presentation for the entity referred to bythe selected word. In order to generate the currency contextual searchpresentation, the system requests a currency answer box for the wordselected by the user from the search engine that presents an amount inthe particular currency and a corresponding amount in the currencyassociated with the user. For example, the system can request theconversion answer box by submitting a search query having apre-determined syntax to the search engine, e.g., “[amount] [particularcurrency] to [currency associated with the user]” or “how much is[amount] [particular currency] in [currency associated with the user],”where [amount] is either a default amount or an amount identified by theword selection or context data, [particular currency] is the particularcurrency, and [currency associated with the user] is the currencyassociated with the user.

The currency contextual search presentation may also include searchresults obtained from the search engine. The search results may includeone or more of search results obtained in response to the search queryderived from the selected word, search results from other resultsources, or search results other interpretations of the search query. Insome implementations, the search results include search results obtainedfor another search query that is different from the search querysubmitted to the search engine in order to obtain the currency answerbox. For example, the search results for the other search query mayinclude results about recent news about changes in the value of thecurrency or results about the history of the currency.

As another example, the special case contextual search presentations mayinclude a translation contextual search presentation. A translationcontextual search presentation is a contextual search presentation thatincludes a translation answer box. A translation answer box is an answerbox that presents a translation of a word from one language to another.

In order to determine whether the criteria for presenting thetranslation contextual search presentation are satisfied, the systemdetermines the language that the word selected by the user is written inand whether the language of the selected word is different from alanguage associated with the user, e.g., a language identified in userprofile data for the user as a language spoken by the user or anofficial language for the country of residence of the user.

If the language of the selected word is different from a languageassociated with the user, the system determines that the criteria forpresenting a translation contextual search presentation are satisfiedand generates a translation contextual search presentation for theentity referred to by the selected word. In order to generate thetranslation contextual search presentation, the system requests atranslation answer box for the word selected by the user from the searchengine that presents a translation of the selected word into thelanguage associated with the user. For example, the system can requestthe translation answer box by submitting a search query having apre-determined syntax to the search engine, e.g., “translate [word] into[language associated with the user]” or “translate [word] from [wordlanguage] to [language associated with the user],” where [word] is theselected word, [language associated with the user] is the languageassociated with the user, and [word language] is the language the wordis written in.

The translation contextual search presentation may also include searchresults obtained from the search engine. The search results may includeone or more of search results obtained in response to the search queryderived from the selected word, search results from other resultsources, or search results other interpretations of the search query. Insome implementations, the search results include search results obtainedfor another search query that is different from the search querysubmitted to the search engine in order to obtain the answer box. Forexample, the search results for the other search query may includeimages corresponding to the selected word.

As another example, the special case contextual search presentations mayinclude a time zone contextual search presentation. A time zonecontextual search presentation is a contextual search presentation thatincludes a time zone answer box. A time zone answer box is an answer boxthat presents a conversion of a time from one time zone to another.

In order to determine whether the criteria for presenting the time zonecontextual search presentation are satisfied, the system determineswhether the selected word identifies a time in a particular time zoneand, if so, whether the particular time zone is different from a timezone associated with the user, e.g., the time zone for the residence ofthe user identified in user profile data for the user or the time zoneof the current location of the user device. The system may determinethat the selected word identifies a time in a particular time zone ifthe selected word identifies a time zone and the context data includes atime, if the selected word identifies a time and the context dataidentifies a time zone, or both.

If the particular time zone is different from a time zone associatedwith the user, the system determines that the criteria for presenting atime zone contextual search presentation are satisfied and generates atime zone contextual search presentation for the entity referred to bythe selected word. In order to generate the time zone contextual searchpresentation, the system requests a time zone answer box for the wordselected by the user from the search engine that includes presents thetime from the particular time zone that corresponds to the time zoneassociated with the user. For example, the system can request the timezone answer box by submitting a search query having a pre-determinedsyntax to the search engine, e.g., “convert [time] [particular timezone] to [time zone associated with the user]” or “what time is [time][particular time zone] in [time zone associated with the user],” where[time] is the time, [particular time zone] is the particular time zone,and [time zone associated with the user] is the time zone associatedwith the user.

The time zone contextual search presentation may also include searchresults obtained from the search engine. The search results may includeone or more of search results obtained in response to the search queryderived from the selected word, search results from other resultsources, or search results other interpretations of the search query. Insome implementations, the search results include search results obtainedfor another search query that is different from the search querysubmitted to the search engine in order to obtain the currency answerbox. For example, the search results for the other search query mayinclude search results about maps of the time zone.

The above description describes certain special case contextual searchpresentations. However, other special case contextual searchpresentations may be presented when other criteria are satisfied. Forexample, other special case contextual presentations may include variouskinds of unit conversion answer boxes that present conversion ofmeasurements in one unit to measurements in other units.

The above description describes receiving word selection data thatidentifies a word selected by a user from a document displayed be theuser. However, in some implementations, the selection data can identifydifferent portions of the document that have been selected by the user,e.g., a term, i.e., one or more adjacent words, from the document. Inthese implementations, the system can receive and process the selectiondata in the same manner as described above for the word selection data.

In situations in which the systems described here collect personalinformation about users, or may make use of personal information, theusers may be provided with an opportunity to control whether programs orfeatures collect user information, e.g., user profile data and userdevice data, or to control whether and/or how to receive content thatmay be more relevant to the user. In addition, certain data may betreated in one or more ways before it is stored or used, so thatpersonally identifiable information is removed. For example, a user'sidentity may be treated so that no personally identifiable informationcan be determined for the user, or a user's geographic location may begeneralized where location information is obtained, such as to a city,postal code, or state level, so that a particular location of a usercannot be determined. Thus, the user may have control over howinformation is collected about the user and used by the system.

Embodiments of the subject matter and the functional operationsdescribed in this specification can be implemented in digital electroniccircuitry, in tangibly-embodied computer software or firmware, incomputer hardware, including the structures disclosed in thisspecification and their structural equivalents, or in combinations ofone or more of them. Embodiments of the subject matter described in thisspecification can be implemented as one or more computer programs, i.e.,one or more modules of computer program instructions encoded on atangible non-transitory program carrier for execution by, or to controlthe operation of, data processing apparatus. Alternatively or inaddition, the program instructions can be encoded on anartificially-generated propagated signal, e.g., a machine-generatedelectrical, optical, or electromagnetic signal, that is generated toencode information for transmission to suitable receiver apparatus forexecution by a data processing apparatus. The computer storage mediumcan be a machine-readable storage device, a machine-readable storagesubstrate, a random or serial access memory device, or a combination ofone or more of them.

The term “data processing apparatus” encompasses all kinds of apparatus,devices, and machines for processing data, including by way of example aprogrammable processor, a computer, or multiple processors or computers.The apparatus can include special purpose logic circuitry, e.g., an FPGA(field programmable gate array) or an ASIC (application-specificintegrated circuit). The apparatus can also include, in addition tohardware, code that creates an execution environment for the computerprogram in question, e.g., code that constitutes processor firmware, aprotocol stack, a database management system, an operating system, or acombination of one or more of them.

A computer program (which may also be referred to or described as aprogram, software, a software application, a module, a software module,a script, or code) can be written in any form of programming language,including compiled or interpreted languages, or declarative orprocedural languages, and it can be deployed in any form, including as astandalone program or as a module, component, subroutine, or other unitsuitable for use in a computing environment. A computer program may, butneed not, correspond to a file in a file system. A program can be storedin a portion of a file that holds other programs or data, e.g., one ormore scripts stored in a markup language document, in a single filededicated to the program in question, or in multiple coordinated files,e.g., files that store one or more modules, subprograms, or portions ofcode. A computer program can be deployed to be executed on one computeror on multiple computers that are located at one site or distributedacross multiple sites and interconnected by a communication network.

The processes and logic flows described in this specification can beperformed by one or more programmable computers executing one or morecomputer programs to perform functions by operating on input data andgenerating output. The processes and logic flows can also be performedby, and apparatus can also be implemented as, special purpose logiccircuitry, e.g., an FPGA (field programmable gate array) or an ASIC(application-specific integrated circuit).

Computers suitable for the execution of a computer program include, byway of example, can be based on general or special purposemicroprocessors or both, or any other kind of central processing unit.Generally, a central processing unit will receive instructions and datafrom a read-only memory or a random access memory or both. The essentialelements of a computer are a central processing unit for performing orexecuting instructions and one or more memory devices for storinginstructions and data. Generally, a computer will also include, or beoperatively coupled to receive data from or transfer data to, or both,one or more mass storage devices for storing data, e.g., magnetic,magneto-optical disks, or optical disks. However, a computer need nothave such devices. Moreover, a computer can be embedded in anotherdevice, e.g., a mobile telephone, a personal digital assistant (PDA), amobile audio or video player, a game console, a Global PositioningSystem (GPS) receiver, or a portable storage device, e.g., a universalserial bus (USB) flash drive, to name just a few.

Computer-readable media suitable for storing computer programinstructions and data include all forms of nonvolatile memory, media andmemory devices, including by way of example semiconductor memorydevices, e.g., EPROM, EEPROM, and flash memory devices; magnetic disks,e.g., internal hard disks or removable disks; magneto-optical disks; andCDROM and DVD-ROM disks. The processor and the memory can besupplemented by, or incorporated in, special purpose logic circuitry.

To provide for interaction with a user, embodiments of the subjectmatter described in this specification can be implemented on a computerhaving a display device, e.g., a CRT (cathode ray tube) or LCD (liquidcrystal display) monitor, for displaying information to the user and akeyboard and a pointing device, e.g., a mouse or a trackball, by whichthe user can provide input to the computer. Other kinds of devices canbe used to provide for interaction with a user as well; for example,feedback provided to the user can be any form of sensory feedback, e.g.,visual feedback, auditory feedback, or tactile feedback; and input fromthe user can be received in any form, including acoustic, speech, ortactile input. In addition, a computer can interact with a user bysending documents to and receiving documents from a device that is usedby the user; for example, by sending web pages to a web browser on auser's user device in response to requests received from the webbrowser.

Embodiments of the subject matter described in this specification can beimplemented in a computing system that includes a backend component,e.g., as a data server, or that includes a middleware component, e.g.,an application server, or that includes a frontend component, e.g., aclient computer having a graphical user interface or a Web browserthrough which a user can interact with an implementation of the subjectmatter described in this specification, or any combination of one ormore such backend, middleware, or frontend components. The components ofthe system can be interconnected by any form or medium of digital datacommunication, e.g., a communication network. Examples of communicationnetworks include a local area network (“LAN”) and a wide area network(“WAN”), e.g., the Internet.

The computing system can include clients and servers. A client andserver are generally remote from each other and typically interactthrough a communication network. The relationship of client and serverarises by virtue of computer programs running on the respectivecomputers and having a client-server relationship to each other.

While this specification contains many specific implementation details,these should not be construed as limitations on the scope of anyinvention or of what may be claimed, but rather as descriptions offeatures that may be specific to particular embodiments of particularinventions. Certain features that are described in this specification inthe context of separate embodiments can also be implemented incombination in a single embodiment. Conversely, various features thatare described in the context of a single embodiment can also beimplemented in multiple embodiments separately or in any suitablesubcombination. Moreover, although features may be described above asacting in certain combinations and even initially claimed as such, oneor more features from a claimed combination can in some cases be excisedfrom the combination, and the claimed combination may be directed to asubcombination or variation of a subcombination.

Similarly, while operations are depicted in the drawings in a particularorder, this should not be understood as requiring that such operationsbe performed in the particular order shown or in sequential order, orthat all illustrated operations be performed, to achieve desirableresults. In certain circumstances, multitasking and parallel processingmay be advantageous. Moreover, the separation of various system modulesand components in the embodiments described above should not beunderstood as requiring such separation in all embodiments, and itshould be understood that the described program components and systemscan generally be integrated together in a single software product orpackaged into multiple software products.

Particular embodiments of the subject matter have been described. Otherembodiments are within the scope of the following claims. For example,the actions recited in the claims can be performed in a different orderand still achieve desirable results. As one example, the processesdepicted in the accompanying figures do not necessarily require theparticular order shown, or sequential order, to achieve desirableresults. In some cases, multitasking and parallel processing may beadvantageous.

What is claimed is:
 1. A method comprising: obtaining selection dataidentifying a term selected by a user from a document displayed to theuser, the term comprising one or more adjacent words; obtaining contextdata comprising one or more other words in the document; determining,from the context data and the selection data, a type of contextualsearch presentation to request from a search engine for the selectedterm, comprising: determining whether or not the context data and theselection data satisfy one or more criteria for presenting any of one ormore types of special case contextual search presentations, wherein eachtype of special case contextual search presentation includes a formattedpresentation of a different type of content; in response to determiningthat the context data and the selection data satisfy one or morecriteria for presenting a first type of special case contextual searchpresentation: obtaining, from the search engine, a first special casecontextual search presentation for the term identified by the selectiondata that includes a first type of content corresponding to the firsttype of special case contextual presentation; in response to determiningthat the context data and the selection data do not satisfy the criteriafor presenting any of the types of special case contextual searchpresentations: obtaining, from the search engine, a default contextualsearch presentation for the selected term that includes a second type ofcontent corresponding to the default contextual search presentation; andproviding the first special case contextual search presentation or thedefault contextual search presentation for presentation to the user. 2.The method of claim 1, wherein the default contextual searchpresentation comprises a definitional answer box, wherein thedefinitional answer box is a formatted presentation of a definition ofthe term selected by the user, and wherein obtaining the contextualsearch presentation comprises obtaining the definitional answer box fromthe search engine in response to a first search query that includes theselected term.
 3. The method of claim 2, wherein obtaining the defaultcontextual search presentation further comprises obtaining searchresults from the search engine for one or more search queries derivedfrom the selected term.
 4. The method of claim 1, wherein the one ormore types of special case contextual search presentations comprise anentity type of contextual search presentation that includes a knowledgepanel, and wherein a knowledge panel is a formatted presentation ofcontent relevant to an entity.
 5. The method of claim 4, whereindetermining whether or not the context data and the selection datasatisfy one or more criteria for presenting the entity type of specialcase contextual search presentation comprises: determining, by providingthe context data and the selection data to an entity disambiguationsystem, whether or not the selected term refers to an entity in contextof the other words in the document.
 6. The method of claim 5, furthercomprising: determining that the selected term refers to an entity incontext of the other words in the document; and obtaining an entitycontextual search presentation for the selected term, comprisingobtaining a knowledge panel for the entity referred to by the selectedterm from the search engine.
 7. The method of claim 1, wherein the oneor more types of special case contextual search presentations comprise acurrency type of contextual search presentation that includes a currencyanswer box, wherein a currency answer box is a formatted presentation ofan amount in a first currency and a corresponding amount in a secondcurrency.
 8. The method of claim 7, wherein determining whether or notthe context data and the selection data satisfy one or more criteria forpresenting the currency type of contextual search presentationcomprises: determining whether or not the context data and selectiondata identify any currency and any identified currency is different froma currency associated with the user.
 9. The method of claim 8, furthercomprising: determining that the context data and the selection dataidentify an amount in an identified currency and that the identifiedcurrency is different from the currency associated with the user; andobtaining a currency contextual search presentation for the context dataand the selection data, comprising obtaining, from the search engine, acurrency answer box including an amount in the identified currency and acorresponding amount in the currency associated with the user.
 10. Themethod of claim 1, wherein the one or more types of special casecontextual search presentations comprise a translation type ofcontextual search presentation that includes a translation answer box,and wherein a translation answer box is a formatted presentation of atranslation of a word in a first language to a word in a secondlanguage.
 11. The method of claim 10, wherein determining whether or notthe context data and the selection data satisfy one or more criteria forpresenting the translation type of contextual search presentationcomprises: identifying a language in which the selected term is writtenand determining whether or not the language in which the selected termis written is different from a language associated with the user. 12.The method of claim 11, further comprising: determining that thelanguage in which the selected term is written is different from thelanguage associated with the user of the user device; and obtaining atranslation contextual search presentation for the selected term,comprising obtaining, from the search engine, a translation answer boxincluding a translation of the selected term into the languageassociated with the user.
 13. The method of claim 1, wherein the one ormore types of special case contextual search presentations comprise atime zone type of contextual search presentation that includes a timezone answer box, wherein a time zone answer box is a formattedpresentation of a time in a first time zone and a corresponding time ina second time zone.
 14. The method of claim 13, wherein determiningwhether or not the context data and the selection data satisfy one ormore criteria for presenting the time zone type of contextual searchpresentation comprises: determining whether or not the selected termidentifies a time in a particular time zone and whether the particulartime zone is different from a time zone associated with the user. 15.The method of claim 14, further comprising: determining that theselected term identifies a time in a particular time zone that isdifferent from the time zone associated with the user; obtaining a timezone contextual search presentation for the selected term, comprisingobtaining, from the search engine, a time zone answer box the time inthe particular time zone and a corresponding time in the time zoneassociated with the user.
 16. The method of claim 1, wherein at least aportion of the first special case contextual search presentation or thedefault contextual search presentation is displayed to the user while atleast a portion of the document continues to be displayed to the user.17. The method of claim 16, wherein a user interface element separatesthe displayed portion of the first special case contextual searchpresentation or the default contextual search presentation from theportion of the document that continues to be displayed to the user, andwherein, in response to a user input adjusting a position of the userinterface element, the portion of the first special case contextualsearch presentation or the default contextual search that is displayedto the user is adjusted.
 18. The method of claim 17, wherein, inresponse to the user input adjusting the position of the user interfaceelement to adjust the portion of the first special case contextualsearch presentation or the default contextual search that is displayedto the user, the displayed document is re-centered so that at least theselected term remains visible.
 19. The method of claim 1, whereinproviding the first special case contextual search presentation or thedefault contextual search presentation for presentation to the usercomprises providing the first special case contextual searchpresentation or the default contextual search presentation forpresentation to the user as an overlay on the displayed document.
 20. Asystem comprising one or more computers and one or more storage devicesstoring instructions that when executed by the one or more computerscause the one or more computers to perform operations comprising:obtaining selection data identifying a term selected by a user from adocument displayed to the user, the term comprising one or more adjacentwords; obtaining context data comprising one or more other words in thedocument; determining, from the context data and the selection data, atype of contextual search presentation to request from a search enginefor the selected term, comprising: determining whether or not thecontext data and the selection data satisfy one or more criteria forpresenting any of one or more types of special case contextual searchpresentations, wherein each type of special case contextual searchpresentation includes a formatted presentation of a different type ofcontent; in response to determining that the context data and theselection data satisfy one or more criteria for presenting a first typeof special case contextual search presentation: obtaining, from thesearch engine, a first special case contextual search presentation forthe term identified by the selection data that includes a first type ofcontent corresponding to the first type of special case contextualpresentation; in response to determining that the context data and theselection data do not satisfy the criteria for presenting any of thetypes of special case contextual search presentations: obtaining, fromthe search engine, a default contextual search presentation for theselected term that includes a second type of content corresponding tothe default contextual search presentation; and providing the firstspecial case contextual search presentation or the default contextualsearch presentation for presentation to the user.
 21. The system ofclaim 20, wherein the default contextual search presentation comprises adefinitional answer box, wherein the definitional answer box is aformatted presentation of a definition of the term selected by the user,and wherein obtaining the contextual search presentation comprisesobtaining the definitional answer box from a search engine in responseto a first search query that includes the selected term.
 22. The systemof claim 20, wherein the one or more types of special case contextualsearch presentations comprise an entity type of contextual searchpresentation that includes a knowledge panel, and wherein a knowledgepanel is a formatted presentation of content relevant to an entity. 23.The system of claim 22, further comprising: determining that theselected term refers to an entity in context of the other words in thedocument; and obtaining an entity contextual search presentation for theselected term, comprising obtaining a knowledge panel for the entityreferred to by the selected term from a search engine.
 24. A computerprogram encoded on a non-transitory computer storage medium, the programcomprising instructions that when executed by one or more computerscause the one or more computers to perform operations comprising:obtaining selection data identifying a term selected by a user from adocument displayed to the user, the term comprising one or more adjacentwords; obtaining context data comprising one or more other words in thedocument; determining, from the context data and the selection data, atype of contextual search presentation to request from a search enginefor the selected term, comprising: determining whether or not thecontext data and the selection data satisfy one or more criteria forpresenting any of one or more types of special case contextual searchpresentations, wherein each type of special case contextual searchpresentation includes a formatted presentation of a different type ofcontent; in response to determining that the context data and theselection data satisfy one or more criteria for presenting a first typeof special case contextual search presentation: obtaining, from thesearch engine, a first special case contextual search presentation forthe term identified by the selection data that includes a first type ofcontent corresponding to the first type of special case contextualpresentation; in response to determining that the context data and theselection data do not satisfy the criteria for presenting any of thetypes of special case contextual search presentations: obtaining, fromthe search engine, a default contextual search presentation for theselected term that includes a second type of content corresponding tothe default contextual search presentation; and providing the firstspecial case contextual search presentation or the default contextualsearch presentation for presentation to the user.